package com.example.hibernate.h.one2many_bag;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="T_BID")
@SequenceGenerator(name="SEQ_BID", sequenceName="SEQ_BID", initialValue=1)
@org.hibernate.annotations.Entity(
		dynamicInsert=true,dynamicUpdate=true
	)
public class Bid {
	
	@Id @GeneratedValue(generator="SEQ_BID")
	private Long id;
	private String account;
	
	@ManyToOne
	@JoinColumn(name="ITEM_ID", nullable=false)
	private Item item;

	public Long getId() {
		return id;
	}

	private void setId(Long id) {
		this.id = id;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	@Override
	public String toString() {
		return "Bid [id=" + id + ", account=" + account + ", item=" + item + "]";
	}
}
